home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls085.solintel.Z / tls085.solintel / lib / vtcl / tests / beep3.tcl < prev    next >
Encoding:
Text File  |  1995-07-20  |  2.5 KB  |  122 lines

  1. # CVS $Id: beep3.tcl,v 1.1 1995/02/03 17:15:15 zibi Exp $
  2. # Demo of the use of "VtBeep"
  3. # - Set the pitch, duration and volume.
  4. #
  5. proc DoQuit {cbs} {
  6.     VtClose
  7.     exit 0
  8. }
  9.  
  10. proc SetPitch {value cbs} {
  11.     global pitch 
  12.     set pitch $value
  13. }
  14. proc SetVolume {value cbs} {
  15.     global volume 
  16.     set volume $value
  17. }
  18. proc SetDuration {value cbs} {
  19.     global duration 
  20.     set duration $value
  21. }
  22. #
  23. # Callback that invokes VtBeep with the current values.
  24. #
  25. proc beep {cbs} {
  26.     global pitch duration volume
  27.     echo pitch:$pitch duration:$duration volume:$volume
  28.     VtBeep -duration $duration \
  29.     -pitch $pitch \
  30.     -volume $volume
  31. }
  32.  
  33. # Open connection to Widget Server
  34. set app [VtOpen joe]
  35. set mainF [VtFormDialog $app.mainF -title "beep program"]
  36.  
  37. # Create radiobox for setting the Pitch value
  38. #
  39. set pitchFR [VtFrame $mainF.pitchFR \
  40.     -title "Pitch" \
  41.     -shadowType ETCHED_OUT \
  42.     ]
  43. set pitchRB [VtRadioBox $pitchFR.pitchRB \
  44.     ]
  45. VtToggleButton $pitchRB.pitchLow \
  46.     -label Low \
  47.     -callback "SetPitch 100"
  48. VtToggleButton $pitchRB.pitchMed \
  49.     -label Medium \
  50.     -callback "SetPitch 500" \
  51.     -set 1
  52. VtToggleButton $pitchRB.pitchHigh \
  53.     -label High \
  54.     -callback "SetPitch 1000"
  55. set pitch 500
  56.  
  57. # Create radiobox for setting the volume value
  58. #
  59. set volFR [VtFrame $mainF.volFR \
  60.     -title "Volume" \
  61.     -shadowType ETCHED_OUT \
  62.     -leftSide $pitchFR \
  63.     -alignTop $pitchFR \
  64.     ]
  65. set volRB [VtRadioBox $volFR.volRB \
  66.     ]
  67. VtToggleButton $volRB.volLow \
  68.     -label Off \
  69.     -xmArgs "XmNforeground red" \
  70.     -callback {SetVolume {-100}}
  71. VtToggleButton $volRB.volMed \
  72.     -label Normal \
  73.     -callback {SetVolume 50} \
  74.     -set 1
  75. VtToggleButton $volRB.volHigh \
  76.     -label Loud \
  77.     -callback {SetVolume 100}
  78. set volume 50
  79.  
  80. # Create radiobox for setting the duration value
  81. #
  82. set durationFR [VtFrame $mainF.durationFR \
  83.     -title "Duration" \
  84.     -shadowType ETCHED_OUT \
  85.     -leftSide $volFR \
  86.     -rightSide FORM \
  87.     -alignTop $volFR \
  88.     ]
  89. set durationRB [VtRadioBox $durationFR.durationRB \
  90.     ]
  91. VtToggleButton $durationRB.durationLow \
  92.     -label "Short (.1 sec)" \
  93.     -callback {SetDuration 100}
  94. VtToggleButton $durationRB.durationMed \
  95.     -label "Normal (.5 sec)" \
  96.     -callback {SetDuration 500} \
  97.     -set 1
  98. VtToggleButton $durationRB.durationHigh \
  99.     -label "Long (1 sec)" \
  100.     -callback {SetDuration 1000}
  101. set duration 500
  102.  
  103. set rc [VtRowColumn $mainF.rc\
  104.      -leftSide FORM    \
  105.      -rightSide FORM    \
  106.     -topSide $volFR\
  107.     -packing COLUMN\
  108.     -bottomSide FORM\
  109.     -horizontal \
  110.     ]
  111. set pb [VtPushButton $rc.pb \
  112.     -label "Beep" \
  113.     -callback beep \
  114.     ]
  115. set quit [VtPushButton $rc.quit \
  116.     -label "Quit" \
  117.     -callback DoQuit \
  118.     ]
  119.  
  120. VtShow $mainF
  121. VtMainLoop
  122.